using System;
using System.Collections.Generic;
using System.Text;

namespace Yozeev.Common
{
    /// <summary>
    /// 计算剩余数帮助类
    /// </summary>
    public class TicketQuantity
    {
        /// <summary>
        /// 总数
        /// </summary>
        public long totalQuantity { get; set; }
        /// <summary>
        /// 剩余数
        /// </summary>
        public long surplusQuantity { get; set; }
        /// <summary>
        /// 预留数
        /// </summary>
        public long reserveQuantity { get; set; }

        public TicketQuantity(long _total,long _surplus,long _reserve)
        {
            this.totalQuantity = _total;
            this.surplusQuantity = _surplus;
            this.reserveQuantity = _reserve;
        }
        public static TicketQuantity ModifyReserve(TicketQuantity ticketQuantity,long newReserve)
        {
            if (newReserve == 0) return ticketQuantity;
            var temp = newReserve - ticketQuantity.reserveQuantity;
            if (temp > ticketQuantity.surplusQuantity)
                throw new Exception("预留数过大,应该小于" + temp);
            ticketQuantity.reserveQuantity = newReserve;
            ticketQuantity.surplusQuantity = ticketQuantity.surplusQuantity - temp;
            return ticketQuantity;
        }
    }
    /// <summary>
    /// 各个仓位预留数
    /// </summary>
    public class WareReserveQuantity
    {
        /// <summary>
        /// 航班Id
        /// </summary>
        public Guid ScheduleId { get; set; }
        /// <summary>
        /// 标准仓预留数
        /// </summary>
        public long standardQuantity { get; set; }
        /// <summary>
        /// VIP仓预留数
        /// </summary>
        public long vipQuantity { get; set; }
        /// <summary>
        /// 包间预留数
        /// </summary>
        public long compartmentQuantity { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string remark { get; set; }
    }
}
